<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        div {
            width: 200px;
            height: 200px;
            background-color: #333;
        }
    </style>
</head>

<body>
    <div id="box"></div>
    <script>
        var oBox = document.getElementById('box');

        // 当鼠标按下并且松开时才会触发
        oBox.onclick = function() {
            console.log('我是onclick');
        };

        // 当鼠标双击时会触发
        oBox.ondblclick = function() {
            console.log('我是ondblclick');
        }

        // 当鼠标按下时就会触发
        oBox.onmousedown = function() {
            console.log('我是onmousedown');
        };

        // 当鼠标按键抬起时才会触发
        oBox.onmouseup = function() {
            console.log('我是onmouseup');
        };

        // 当鼠标光标进入元素时才会触发
        oBox.onmouseenter = function() {
            console.log('我是onmouseenter');
        };

        // 当鼠标光标离开元素时才会触发
        oBox.onmouseleave = function() {
            console.log('我是onmouseleave');
        };

        // 当鼠标在元素内移动时才会触发
        oBox.onmousemove = function() {
            console.log('我是onmousemove');
        };
    </script>
</body>

</html>